package com.xjscrm.console.web.list;

import com.xjscrm.console.param.list.BatchDeleListDto;
import com.xjscrm.console.param.list.BlackWhiteListLogQuery;
import com.xjscrm.console.param.list.WwCustomerBlackDto;
import com.xjscrm.console.param.list.WwCustomerListQuery;
import com.xjscrm.console.service.customer.list.BatchListService;
import com.xjscrm.console.service.customer.list.BlackListService;
import com.xjscrm.console.vo.BlackWhiteListLogVo;
import com.xjscrm.console.vo.WwCustomerBlackVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "黑名单管理", tags = "黑名单管理")
@RestController
@RequestMapping(value = "/blacklist")
public class BlackListController {

    @Autowired
    private BlackListService blackListService;

    @Autowired
    private BatchListService batchListService;


    @ApiOperation(value = "新增黑名单", notes = "新增黑名单",response = Boolean.class)
    @PostMapping(value ="/addBlackList" )
    public Object addBlackList(@RequestBody WwCustomerBlackDto wwCustomerBlackDto)throws Exception{
        batchListService.addBlackList(wwCustomerBlackDto);
        return true;
    }

    @ApiOperation(value = "获取黑名单列表", notes = "获取黑名单列表",response = WwCustomerBlackVo.class)
    @PostMapping(value ="/getBlackList" )
    public Object getBlackList(@RequestBody WwCustomerListQuery wwCustomerBlackQuery)throws Exception{
        return blackListService.getBlackList(wwCustomerBlackQuery);
    }

    @ApiOperation(value = "批量删除黑名单", notes = "批量删除黑名单",response = Boolean.class)
    @PostMapping(value ="/batchDeleBlackList" )
    public Object batchDeleBlackList(@RequestBody BatchDeleListDto batchDeleListDto)throws Exception{
        batchListService.batchDeleBlackList(batchDeleListDto);
        return true;
    }


    @ApiOperation(value = "获取操作日志", notes = "获取操作日志",response = BlackWhiteListLogVo.class)
    @PostMapping(value ="/getBlackWhiteListLogList" )
    public Object getBlackWhiteListLogList(@RequestBody BlackWhiteListLogQuery blackWhiteListLogQuery)throws Exception{
        return blackListService.getBlackWhiteListLogList(blackWhiteListLogQuery);

    }
}
